package com.skywolf.chem.match.controller;


import com.skywolf.chem.common.sysconfig.response.RespData;
import com.skywolf.chem.match.params.vo.MatchGroupInfoQueryVo;
import com.skywolf.chem.match.params.vo.MatchGroupPageInfoQueryVo;
import com.skywolf.chem.match.service.IGroupInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.sql.ResultSet;

/**
 * <p>
 * 赛事组别 前端控制器
 * </p>
 *
 * @author sj
 * @since 2021-09-24
 */
@AllArgsConstructor
@RestController
@RequestMapping("/match/group-info")
@Api(value = "赛事：组别管理", tags = {"赛事：组别管理API"})
public class GroupInfoController extends BaseController {

    private final IGroupInfoService groupInfoService;

    @ApiOperation(value = "根据活动编号分页查询组别列表", notes = "根据活动编号分页查询组别列表")
    @GetMapping(value = "/get/by/{id}")
    @ApiImplicitParam(name = "id", value = "组别id", paramType = "path", dataType = "Long")
    public RespData<MatchGroupPageInfoQueryVo> getMatchInfoById(@PathVariable("id") Long id) throws Exception {
        MatchGroupPageInfoQueryVo vo = groupInfoService.getMatchInfoById(id, getUserId());
        return RespData.success(vo);
    }

    @ApiOperation(value = "根据组别编号和活动编号查询组别详情", notes = "根据组别编号和活动编号查询组别详情")
    @GetMapping(value = "/get/by/{matchId}/{groupId}")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "matchId", value = "活动id", paramType = "path", dataType = "Long"),
            @ApiImplicitParam(name = "groupId", value = "组别id", paramType = "path", dataType = "Long")
    })
    public RespData<MatchGroupInfoQueryVo> getInfo(@PathVariable("matchId") Long matchId, @PathVariable("groupId") Long groupId) {
        MatchGroupInfoQueryVo vo = groupInfoService.getInfo(matchId, groupId, getUserId());
        return RespData.success(vo);
    }


}
